package com.baozhun.mall.common.util.onkeylogin

import android.content.Context
import com.alibaba.android.arouter.facade.Postcard
import com.alibaba.android.arouter.facade.annotation.Interceptor
import com.alibaba.android.arouter.facade.callback.InterceptorCallback
import com.alibaba.android.arouter.facade.template.IInterceptor
import com.alibaba.android.arouter.launcher.ARouter
import com.baozhun.mall.common.arouter.RoutePath

/**
 * @Title：
 * @Description：
 * @Author：xuefeng.zhu
 * @Since：2023/10/19
 * @Version：1.0.0
 */
@Interceptor(priority = 1)
class LoginActionInterceptor : IInterceptor {

    override fun init(context: Context?) {

    }

    override fun process(postcard: Postcard?, callback: InterceptorCallback?) {
        var needInterceptor = postcard?.extras?.getBoolean(OneKeyLoginHelper.NEED_INTERCEPTOR, true)
        //需求变更，不跳转邀请码填写页面
//        if (postcard?.path.equals(RoutePath.Me.LOGIN) && needInterceptor == true) {
//            callback?.onInterrupt(null)
////            ARouter.getInstance().build(RoutePath.Me.INVITE_CODE).navigation()
//            OneKeyLoginHelper.getInstance().startLoginAuthPage("")
//        } else {
//            callback?.onContinue(postcard)
//        }
        callback?.onContinue(postcard)
    }

}